home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 14844 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: news.cid.sco.com!patrick
  2. From: patrick@sco.com (Patrick Caulfield)
  3. Newsgroups: comp.lang.c++,comp.os.ms-windows.programmer.win32
  4. Subject: Re: VC++ 4.0 memory allocation slower than in 2.x!!!
  5. Date: Tue, 02 Apr 96 10:43:55 GMT
  6. Organization: SCO Client Integration Division
  7. Message-ID: <4jr0hm$o29@avon.x.co.uk>
  8. References: <alanDozpsy.Kn6@netcom.com> <4jgde4$kgo_001@chem.uva.nl>
  9. NNTP-Posting-Host: patrick.london.sco.com
  10. X-Newsreader: News Xpress 2.0 Beta #0
  11.  
  12. In article <4jgde4$kgo_001@chem.uva.nl>, brands@chemeng.chem.uva.nl (Danny 
  13. Brands) wrote:
  14. >In article <alanDozpsy.Kn6@netcom.com>,
  15. >   alan@netcom.com (Robert Alan Wright) wrote:
  16. >|I recently posted a request for help in determining why a program which
  17. >|was simply recompiled on VC++4.0 suddenly ran 3 times slower than the
  18. >|same one did under VC++ 2.0.
  19. >|
  20. >|I went through all the usual steps of making sure that I had the right
  21. >|compiler/link settings and even built my own version of the MFC
  22. >|libraries to make sure they were fully optimized. 
  23. >|
  24. >|Upon further profiling and other exploration, I found out the problem:
  25. >|THE VC++ 4.0 MEMORY ALLOCATION ROUTINES ARE WAY SLOWER!!!
  26.  
  27. I think this is due to the thread-safe  implementation of the C run-time 
  28. library in VC4 (althouth why the single-threaded one should be the same 
  29. defeats me!)
  30.  
  31. What I did was to have a heap for each thread (not needed if you are writing a 
  32. single-threaded app) and then allocate memory using 
  33. HeapAlloc(...,HEAP_NO_SERIALIZE), the speed seems to be back to normal if you 
  34. do this.
  35.  
  36. Hope this is useful.
  37.  
  38. patrick
  39.  
  40.  
  41. -- 
  42. | Patrick Caulfield                 | Work: patrick@sco.com           |
  43. | SCO Client Integration Division.  | Home: patrick@pandh.demon.co.uk |
  44. | Vision House, Waterside           |                                 |
  45. | Kirkstall Road                    | Voice:       +44 (113) 251 2284 |
  46. | Leeds LS4 2QB                     | FAX:         +44 (113) 251 2102 |
  47. | United Kingdom                    |                                 |
  48.  
  49.